package in.muton.panels.paginator.components.listitems;

import in.muton.edushare.pages.EduShareBasePage;
import in.muton.edushare.pages.common.EdusharePanel;
import in.muton.edushare.pages.curricula.CurriculaSummary;
import in.muton.edushare.pages.deptpages.DeptBatches;
import in.muton.edushare.url.EntityPageParams;
import in.muton.panels.paginator.badgehelpers.course.ProgramBadgeInterface;
import in.muton.panels.paginator.helpers.deletelinks.CurriculaRemove;
import in.muton.panels.paginator.helpers.links.CurriculaLink;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import com.edushare.common.vo.Curricula;
import com.edushare.common.vo.Departments;

public class CurriculaListItem extends EdusharePanel {

	public CurriculaListItem(String id, EduShareBasePage page,
			IModel<Curricula> model, ProgramBadgeInterface pbif){
		super(id, page);
		add(new CurriculaLink("nameLink", model, "name"));
		add(new BookmarkablePageLink<Void>("details", CurriculaSummary.class,
				EntityPageParams.getParams(model)));
		
		
		PageParameters p = EntityPageParams.getParams(new Model<Departments>(model.getObject().getDepartment()));
		Integer i = p.size();
		p.add(i.toString(), model.getObject().getCurriculaId().toString());
		add(new BookmarkablePageLink<Void>("batches", DeptBatches.class, p));
		
		add(new CurriculaRemove("delete", this, model, pbif));
	}

	private static final long serialVersionUID = 2482636049183173795L;
}
